﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMDemo
{
    class NewBinTreeData:InterfaceNewData
    {
        public bool NewData()
        {
            switch (GlobalBinTree.operateType)
            {
                case OperateTypeBinTree.CreTree:
                    InitBinTreeCreate(); break;
                case OperateTypeBinTree.PreOrder:
                case OperateTypeBinTree.InOrder:
                case OperateTypeBinTree.PostOrder:
                    InitBinTreeOrder(); break;
                case OperateTypeBinTree.Hoffman:
                    InitBinTreeHoffman(); break;
            }
            return PublicDataClass.IsInit;
        }
        /// <summary>
        /// 二叉树：遍历
        /// </summary>
        private void InitBinTreeOrder()
        {
            BinTreeBrowseForm tif = new BinTreeBrowseForm();
            tif.ShowDialog();
        }

        private void InitBinTreeCreate()
        {
            BinTreeNewForm tcf = new BinTreeNewForm();
            tcf.ShowDialog();
        }

        private void InitBinTreeHoffman()
        {
            BinTreeHoffman thf = new BinTreeHoffman();
            thf.ShowDialog();
        }
        public void ShowForm(SysDemoForm demof, SysArithmeticForm arif, int Width, int Height)
        {
            demof.Top = 0;
            demof.Left = 0;
            demof.Width = Width * 3 / 5;
            demof.Height = Height;
            demof.Show();

            arif.Top = 0;
            arif.Left = Width * 3 / 5;
            arif.Width = Width * 2 / 5;
            arif.Height = Height;
            arif.Show();
        }
    }
}
